import React, { useState ,useEffect} from "react";
import axios from "axios";
export default function App() {
  const [list, setList] = useState([]);
  const rand1 = Math.floor(Math.random() * 999999 + 1);
  
  useEffect(() => {
    axios.get("/test.json").then((res) => {
    console.log(res.data);
    setList(res.data.data.films);
  });  
  }, []) //传空数组
  return (
    <div>
    03-useEffect
    <ul>
      {list.map((item) => (
        <li key={item.filmId + rand1}>{item.name}</li>
      ))}
    </ul>
  </div>
  )
  
  
   
  
}
